<template>
	<div class="container" ref="refContainer">
		<div class="doc-content">
			<div class="title">徽标组件</div>
			<div class="example-title">引入方式（按需）</div>
			<code-view>
				<template slot="code-js">{{ jsCode1 }}</template>
			</code-view>
			
			<div class="example-title">基础用法</div>
			<code-view>
				<template slot="code-html">{{ htmlCode2 }}</template>
			</code-view>
			
			<div class="example-title">&lt;gr-image&gt;属性</div>
			<gr-table :width="800" :tableData="propertiesExplain" textAlign="left">
				<template v-slot="{rowData}">
					<gr-table-column label="参数名称" width="60">
						{{rowData.attrName}}
					</gr-table-column>
					<gr-table-column label="参数说明" width="150">
						{{rowData.introduce}}
					</gr-table-column>
					<gr-table-column label="类型" width="80">
						{{rowData.type}}
					</gr-table-column>
					<gr-table-column label="可选值" width="120">
						{{rowData.optionValues}}
					</gr-table-column>
					<gr-table-column label="默认值" width="60">
						{{rowData.defaultValue}}
					</gr-table-column>
				</template>
			</gr-table>
			
			<br>
			<br>
			<br>
			<br>
			<br>
		</div>
		<div class="demo-view">
			<div ref="refCellPhone" class="cellphone">
				<iframe src="demo.html#/badgedemo" frameborder="0" width="100%" height="100%"></iframe>
			</div>
		</div>
	</div>
</template>

<script>
	import Demo from '../components/Demo.vue'
	import CodeView from '../components/CodeView.vue'
	export default {
		components: {
			Demo,
			CodeView
		},
		data() {
			return {
				jsCode1: `import {Badge} from 'gabriel-ui'
Vue.use(Badge)`,
				htmlCode2: ``,
				propertiesExplain: [
					{
						attrName: 'content',
						introduce: `徽标内容`,
						type: 'String',
						optionValues: '----',
						defaultValue: '----'
					},
					{
						attrName: 'max',
						introduce: `上限值，超出上限max时，显示为{max}+ ,进针对数字有效`,
						type: 'Number',
						optionValues: '----',
						defaultValue: '99'
					},
					{
						attrName: 'color',
						introduce: `徽标颜色`,
						type: 'String',
						optionValues: '----',
						defaultValue: '#ee0a24'
					},
					{
						attrName: 'hidden',
						introduce: `是否隐藏`,
						type: 'Boolean',
						optionValues: '----',
						defaultValue: 'false'
					}
				]
			}
		},
		mounted() {
			let ele = this.$refs.refCellPhone
			this.$refs.refContainer.addEventListener('scroll', (e)=> {
				ele.style.top = e.target.scrollTop + 'px';
			})
		}
	}
</script>

<style>
</style>
